package com.qcby.chatservice.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qcby.chatservice.entity.dto.ReviewDto;
import com.qcby.chatservice.entity.po.ReviewPo;
import com.qcby.chatservice.mapper.ReviewMapper;
import com.qcby.chatservice.service.IReviewService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * reviewService实现
 *
 * @author cong.zhen
 * @date 2023/01/14
 */
@Service
public class IReviewServiceImpl  implements IReviewService {

    @Resource
    private ReviewMapper reviewMapper;


    public boolean creatReview(ReviewDto reviewDto) {

        //从sso获取姓名
        reviewDto.setFromUserName("甄聪");
        reviewDto.setToUserName("耿超");
        reviewDto.setCreator("甄聪");
        reviewDto.setCreateTime(new Date());

        //todo 应该从枚举里获取
        reviewDto.setStatus(0);
        reviewDto.setDelFlag(0);

        ReviewPo reviewPo = BeanUtil.copyProperties(reviewDto,ReviewPo.class);
        return reviewMapper.insert(reviewPo) > 0;




    }
}
